package com.effvi.common.consts.enumeration;

import java.util.HashMap;
import java.util.Map;

/**
 * 方向枚举
 * @author kelvin.zhang
 *
 */
public enum Direction {
	/**
	 * 东方
	 */
	EAST,
	/**
	 * 西方
	 */
	WEST,
	/**
	 * 南方
	 */	
	SOUTH,
	/**
	 * 北方
	 */
	NORTH,
	/**
	 * 中部
	 */
	CENTRE,
	/**
	 * 东南方
	 */
	SOUTHEAST,
	/**
	 * 东北方
	 */
	NORTHEAST,
	/**
	 * 西南方
	 */
	SOUTHWEST,
	/**
	 * 西北方
	 */
	NORTHWEST;
	
	private static Map<com.effvi.common.consts.enumeration.Direction,String> directionDate;
	
	private static Map<com.effvi.common.consts.enumeration.Direction,Integer> directionValue;
	
	/**
	 * 获取月份描述
	 * @param m
	 * @return
	 */
	public static String getDirectionDescrption(com.effvi.common.consts.enumeration.Direction d){
		if(directionDate == null){
			initDirectionDate();
		}
		return directionDate.get(d);
	}
	
	/**
	 * 获取月份对应的值
	 * @param m
	 * @return
	 */
	public static Integer getDirectionValue(com.effvi.common.consts.enumeration.Direction d){
		if(directionValue == null){
			initDirectionValue();
		}
		return directionValue.get(d);
	}
	
	/**
	 * 初始化月份描述
	 */
	private static synchronized void initDirectionDate(){
		if(directionDate == null){
			directionDate = new HashMap<com.effvi.common.consts.enumeration.Direction, String>();
			directionDate.put(EAST, "东方");
			directionDate.put(WEST, "西方");
			directionDate.put(SOUTH, "南方");
			directionDate.put(NORTH, "北方");
			directionDate.put(CENTRE, "中部");
			directionDate.put(SOUTHEAST, "东南方");
			directionDate.put(NORTHEAST, "东北方");
			directionDate.put(SOUTHWEST, "西南方");
			directionDate.put(NORTHWEST, "西北方");
		}
	}
	
	/**
	 * 初始化月份值
	 */	
	private static synchronized void initDirectionValue(){
		if(directionValue == null){
			directionValue = new HashMap<com.effvi.common.consts.enumeration.Direction, Integer>();
			directionValue.put(EAST, 1);
			directionValue.put(WEST, 2);
			directionValue.put(SOUTH, 3);
			directionValue.put(NORTH, 4);
			directionValue.put(CENTRE, 5);
			directionValue.put(SOUTHEAST, 6);
			directionValue.put(NORTHEAST, 7);
			directionValue.put(SOUTHWEST, 8);
			directionValue.put(NORTHWEST, 9);
		}
	}
}
